package com.tch.controller;

import com.tch.entity.UserEntity01;
import lombok.extern.slf4j.Slf4j;
import lombok.var;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class NumberController {
    @Value("${zk.name}")
    private String name;
    @Value("${zk.sex}")
    private String sex;

    @Autowired
    private UserEntity01 userEntity01;

    @RequestMapping("number")
    public String hello(){
        return "重新写的另一个类";
    }

    /**
     * 使用 @Value 注解
     * @return
     */
    @RequestMapping("getApplicationValue")
    public String getApplicationValue(){
         return name+":" +sex;
    }

    /**
     * 使用 @ConfigurationProperties
     * @return
     */
    @RequestMapping("getConfigurationProperties")
    public String getConfigurationProperties(){
        //log.info("getConfigurationProperties");
        return userEntity01.toString();
    }

    /**
     * 演示打印日志
     * @return
     */
    @RequestMapping("/getName")
    public String getName(String name, int age){
//         log.info("name:{},age:{}",name,age);
//        log.debug("name:{},age:{}",name,age);
//        try {
//
//        }catch (Exception e){
//            log.debug("");
//        }
        return name;
    }


}
